/*
 * @Author: 毕晨曦
 * @Date: 2024-05-08 22:33:30
 * @LastEditors: lihaonan
 * @LastEditTime: 2024-06-26 22:14:07
 * @FilePath: /sushe/src/store/index.ts
 * @Description: 用户数据 store
 */
import { defineStore } from "pinia";
import { ref } from "vue";

export const userStore = defineStore("user", () => {
  // 身份 0 member | 2 coach  | 1 matchmaker
  const identity = ref<number>();
  const data = uni.getStorageSync("identity");
  if (data) {
    identity.value = data
  } else {
    identity.value = 0
  }

  // 设置身份
  function setIdentity(val: number) {
    identity.value = val;
    uni.setStorageSync("identity", identity.value);
  }

  return {
    identity,
    setIdentity,
  };
});
